package cn.lopr.im.socketserver;

import cn.lopr.im.socketserver.constant.Const;
import cn.lopr.im.socketserver.service.IMSocketService;

import java.io.IOException;
import java.net.InetAddress;

/**
 * @author shuangyang7
 * @date 2020/12/19 9:09
 */

public class SocketServesMain {

    private static final int PORT = 1024;

    public static void main(String[] args) {
        try {
            System.out.println(Const.SEND_OFFLINE_MESSAGE);
            IMSocketService socketServer = new IMSocketService(PORT);
            socketServer.start();

            String ip = InetAddress.getLocalHost().getHostAddress();
            int port = socketServer.getPort();
            System.out.println(socketServer.getAddress());
            System.out.printf("服务已启动: %s:%d%n", ip, port);

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
